﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using TimServerSDK.Core;
using TimServerSDK.Core.Enums;
using TimServerSDK.Groups.Dtos;

namespace TimServerSDK.Groups
{
    /// <summary>
    /// 群组管理
    /// </summary>
    public interface IGroupTimServerApi
    {
        /// <summary>
        /// 获取 App 中的所有群组
        /// https://cloud.tencent.com/document/product/269/1614
        /// </summary>
        /// <param name="limit"></param>
        /// <param name="next"></param>
        /// <param name="groupType"></param>
        /// <returns></returns>
        Task<GetGroupListResultDto> GetListAsync(int limit = 10000, int next = 0, TimServerGroupTypeEnum? groupType = null);

        /// <summary>
        /// 创建群组
        /// https://cloud.tencent.com/document/product/269/1615
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<CreateGroupResultDto> CreateAsync(CreateGroupInputDto input);

        /// <summary>
        /// 创建群组
        /// https://cloud.tencent.com/document/product/269/1615
        /// </summary>
        /// <param name="type"></param>
        /// <param name="name"></param>
        /// <param name="ownerAccount"></param>
        /// <param name="groupId"></param>
        /// <param name="introduction"></param>
        /// <param name="notification"></param>
        /// <param name="faceUrl"></param>
        /// <param name="maxMemberCount"></param>
        /// <param name="applyJoinOption"></param>
        /// <param name="appDefinedData"></param>
        /// <param name="memberList"></param>
        /// <returns></returns>
        Task<CreateGroupResultDto> CreateAsync(
            TimServerGroupTypeEnum type,
            string name,
            string ownerAccount = null,
            string groupId = null,
            string introduction = null,
            string notification = null,
            string faceUrl = null,
            int? maxMemberCount = null,
            TimServerApplyJoinEnum applyJoinOption = TimServerApplyJoinEnum.NeedPermission,
            CreateGroupInputDto.Appdefineddata[] appDefinedData = null,
            CreateGroupInputDto.Memberlist[] memberList = null
            );


        /// <summary>
        /// 修改群基础资料
        /// https://cloud.tencent.com/document/product/269/1620
        /// </summary>
        /// <param name="GroupId"></param>
        /// <param name="name"></param>
        /// <param name="introduction"></param>
        /// <param name="notification"></param>
        /// <param name="faceUrl"></param>
        /// <param name="maxMemberNum"></param>
        /// <param name="applyJoinOption"></param>
        /// <param name="muteAllMember"></param>
        /// <param name="appDefinedData"></param>
        /// <returns></returns>
        Task<TimServerResult> ModifyBaseInfoAsync(
            string groupId,
            string name = null,
            string introduction = null,
            string notification = null,
            string faceUrl = null,
            int? maxMemberNum = null,
            string applyJoinOption = null,
            string muteAllMember = null,
            Dictionary<string, string> appDefinedData = null);

        /// <summary>
        /// 增加群成员
        /// https://cloud.tencent.com/document/product/269/1621
        /// </summary>
        /// <param name="groupId">操作的群 ID</param>
        /// <param name="memberList">待添加的群成员数组</param>
        /// <param name="silence">是否静默加人</param>
        /// <returns></returns>
        Task<AddGroupMemberResultDto> AddMemberAsync(string groupId, string[] accounts, bool silence = false);

        /// <summary>
        /// 删除群成员
        /// https://cloud.tencent.com/document/product/269/1622
        /// </summary>
        /// <param name="groupId">操作的群 ID</param>
        /// <param name="accounts">待删除的群成员</param>
        /// <param name="silence">是否静默删人</param>
        /// <param name="reason">踢出用户原因</param>
        /// <returns></returns>
        Task<TimServerResult> DeleteMemberAsync(string groupId, string[] accounts, bool silence = false, string reason = null);

        /// <summary>
        /// 解散群组
        /// https://cloud.tencent.com/document/product/269/1624
        /// </summary>
        /// <param name="groupId">操作的群 ID</param>
        /// <returns></returns>
        Task<TimServerResult> DestroyAsync(string groupId);
    }
}
